<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html class="x-admin-sm">
  
  <head>
    <meta charset="UTF-8">
    <title>修改文章状态</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
   
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/index.css">
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/index.js"></script>

  </head>
  
  <body>
 	<div>
 	 
 	</div>
    <div class="layui-fluid">
        <div class="layui-row">
            
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        	<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        	
        	
        	<form action="" method="post" class="layui-form layui-form-pane" >
                 <div class="layui-form-item layui-form-text" id="content">
                 
                 </div>
                  <div class="layui-form-item">
	                <button class="layui-btn" lay-submit="" lay-filter="" type="button" onclick="bannedUser()" value="Banned">封禁该用户</button>
	                <button class="layui-btn" lay-submit="" lay-filter="" type="button" onclick="unsealUser()" value="Unseal">解封该用户</button>    
					</div>
             
            </form>
        </div>
    </div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
let userId="${param.userId}";
let userMail="${param.userMail}";
let userName="${param.userName}";
let userStatus="${param.userStatus}";
console.log(userId);
console.log(userMail);
console.log(userName);
console.log(userStatus);
  User();
  function User(){
		
			var temp = ``;
			if(userId != null){
					//console.log(articleId.articleTitle);
					temp +=`
						<label for="desc" class="layui-form-label" >
	                用户邮箱
	                    </label>
	                    <div class="layui-input" id="title">
	                        <text placeholder="" id="desc" name="desc" class="layui-textarea" >${param.userMail}</text>
	                    </div>
	                    </div>
	                    <br>
	                     <div class="layui-form-item layui-form-text" id="authorname">
	                      <label for="desc" class="layui-form-label">
	                       用户姓名
	                    </label>
	                    <div class="layui-input">
	                        <text placeholder="" id="desc" name="desc" class="layui-textarea">${param.userName}</text>
	                    </div>
	                </div>
	                <div class="layui-form-item layui-form-text">
	                    <label for="desc" class="layui-form-label" id="content">
	                       用户状态
	                    </label>
	                    <div class="layui-input-block">
	                        <text placeholder="" id="desc" name="desc" class="layui-textarea" >${param.userStatus}</textarea>
	                    </div>
	                </div>
	                <div class="layui-form-item layui-form-text">
	                    <label for="desc" class="layui-form-label">
	                        更改状态原因
	                    </label>
	                    <div class="layui-input-block">
	                        <textarea placeholder="请输入内容" id="desc" name="desc" class="layui-textarea"></textarea>
	                    </div>
	                </div>
	                
	               
                
	                    
						 `;

				
			}
			$("#content").html(temp);
			
		
		
				
  
  

  };
  
  //封禁
  //
  function bannedUser(){
	  $.ajax({
		  async:true,
			type:"post",
			url:"${pageContext.request.contextPath}/AdminOperateUserServlet",
			data:{
				op:"changeUser",
				opd:"banned",
				userId:"${param.userId}",
				userMail:"${param.userMail}",
				userName:"${param.userName}",
				userStatus:"${param.userStatus}"

			},
			contentType:"application/x-www-form-urlencoded",
			dataType:"json",
			success:function(articleId,status,xhr){
	
			} , 
	  });
	  
  };
  
  //解封
  function unsealUser(){
	  $.ajax({
		  async:true,
			type:"post",
			url:"${pageContext.request.contextPath}/AdminOperateUserServlet",
			data:{
				op:"changeUser",
				opd:"unseal",
				userId:"${param.userId}",
				userMail:"${param.userMail}",
				userName:"${param.userName}",
				userStatus:"${param.userStatus}"
			},
			contentType:"application/x-www-form-urlencoded",
			dataType:"json",
			success:function(articleId,status,xhr){
	
			} , 
	  });
	  
  };
</script>	
</body>				
</html>